<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>咕哒猎人</title>
</head>
<body>
<br>
<br>
<br>
<br>
<span onclick="scan()">扫描商品</span>
<br>
<br>
<br>
<span onclick="pay()">支付</span>


<script type="text/javascript" src="$!{path}/static/res/webapp/js/bestpay.api.js?1=1"></script>
<script type="text/javascript">
window.onload = function(){
	App.setTitle("商品详情");
	alert(User.getProduct());
}

function scan(){
	var resultcode = Scanner.scan(function(a,b){
		alert("000 " + a + ", " + b);
	}, function(a,b){
		alert("-- " + a + ", " + b);
	});
}

function pay(){
	alert("修改了支付参数");
	var payJson={
           "MERCHANTID":"02330107050260415",
           "SUBMERCHANTID":"",
           "MERCHANTPWD":"167917", 
           "ORDERSEQ":"1485139264759",
           "ORDERAMOUNT":"0.01",
           "ORDERTIME":"20170123104104",
           "ORDERVALIDITYTIME":"20170123104104",
           "PRODUCTDESC":"Test",
           "CUSTOMERID":"12345678901",
           "PRODUCTAMOUNT":"0.01",
           "ATTACHAMOUNT":"0",
           "CURTYPE":"RMB",
           "BACKMERCHANTURL":"http://127.0.0.1:8040/wapBgNotice.action",
           "ATTACH":"",
//            "PRODUCTID":"04",
//            "USERIP":"192.168.11.130",
           "DIVDETAILS":"",
//            "ACCOUNTID":"12345678901",
           "BUSITYPE":"04",
           "ORDERREQTRANSEQ":"148513926475800002",
           "SERVICE":"mobile.security.pay",
           "SIGNTYPE":"MD5",
//            "SIGN":"223",
           "SUBJECT":"商品测试",
           "SWTICHACC":"true"
//            "SESSIONKEY":"asdfasdfahskfjalsdfkajsdfljasdlfjsjfkj",
//            "OTHERFLOW":"01",              
//            "ACCESSTOKEN":"lajsfsdjfaljdsflajdsfjalkjslaa"
        };
	
	//payJson.SIGN = $.md5($.md5("BESTPAY**#11888" + User.getProduct() + "!@#$%^&*,./quyiyuan"));
	
	//支付成功的回调函数
    var paySuccess = function () { 
    	alert("success");
    }

    //支付失败的回调函数
    var payFail = function () {
    	alert("fail");
    }

    //调起翼支付支付界面
    Payment.onPay(payJson, paySuccess, payFail);
}
</script> 
</body>
</html>